import config from "@/config"
import http from "@/utils/request"

export default {
	user: {
		list: {
			url: `${config.API_URL}/admin/list-page`,
			name: "获取用户列表",
			get: async function (params) {
				return await http.get(this.url, params);
			}
		},
		action: {
			url: `${config.API_URL}/admin`,
			name: "用户操作",
			get: async function (params) {
				return await http.get(this.url, params);
			},
			post: async function (params) {
				return await http.post(this.url, params);
			},
			put: async function (params) {
				return await http.put(this.url, params);
			},
			delete: async function (params) {
				return await http.delete(this.url, params);
			}
		}
	},
	role: {
		list: {
			url: `${config.API_URL}/role/list-page`,
			name: "获取角色列表",
			get: async function (params) {
				return await http.get(this.url, params);
			}
		},
		all: {
			url: `${config.API_URL}/role/all`,
			name: "获取所有角色",
			get: async function (params) {
				return await http.get(this.url, params);
			}
		},
		action: {
			url: `${config.API_URL}/role`,
			name: "角色",
			get: async function (params) {
				return await http.get(this.url, params);
			},
			post: async function (params) {
				return await http.post(this.url, params);
			},
			put: async function (params) {
				return await http.put(this.url, params);
			},
			delete: async function (params) {
				return await http.delete(this.url, params);
			}
		}
	},
	permission: {
		tree: {
			url: `${config.API_URL}/permission/list-tree`,
			name: "获取权限tree",
			get: async function (params) {
				return await http.get(this.url, params);
			}
		}
	},
	// 系统配置
	config: {
		url: `${config.API_URL}/config`,
		name: "获取系统配置",
		get: async function (params) {
			return await http.get(this.url, params);
		},
		put: async function (params) {
			return await http.put(this.url, params);
		}
	},
	// 常用
	common: {
		url: `${config.API_URL}/config/personal`,
		name: "获取个人配置",
		get: async function (params) {
			return await http.get(this.url, params);
		},
		put: async function (params) {
			return await http.put(this.url, params);
		}
	},
}
